
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Welocome TO Bank of ASV</title>
        <link href="templatemo_style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <%@include file="connectionvariables.jsp" %>

        <% if (((String) session.getAttribute("custid")) == null) {
                        response.sendRedirect("index.jsp");
                    }
        %>
        <div id="user" align="center" style="background-color:#A40F0F">
            <label style="color:#FFCC11">Asv Bank Welcomes</label>
            <label style="color:#ffffff" > <%=session.getAttribute("fna")%></label><br/>
            <label style="color:#FFCC11"> Current Account No: </label>
            <label style="color:#ffffff"> <%=session.getAttribute("default")%></label>
            <br/>      <span style="float:right;background-color:#BEC41A"><a href="logout.jsp"><label style="color:white;font-size:13px;"> LOGOUT</label></a></span>
            <span style="float:left;background-color: #BEC41A"><a href="addacc.jsp"><label style="color:white;font-size:13px;"> ADD ACCOUNT</label></a></span>
        </div>

        <div id="templatemo_site_title_bar_wrapper">
            <div id="templatemo_site_title_bar">
                <div id="site_title">
                    <h1><a href="#">
                            <!-- Work Template <span>free css templates</span> -->
                            <img src="images/templatemo_logo.png" alt="myWORK" />
                            <span>ASV Bank</span>

                        </a></h1>
                </div>



            </div> <!-- end of templatemo_site_title_bar -->
        </div> <!-- end of templatemo_site_title_bar_wrapper -->

        <div id="templatemo_menu_wrapper">

            <div id="templatemo_menu">
                <ul>
                    <li><a href="home.jsp" >Home</a></li>
                    <li><a href="profile.jsp">Profile</a></li>
                    <li><a href="accountdet.jsp">Account Details</a></li>
                    <li><a href="enrollbillpay.jsp">Bill Payment Registration</a></li>
                    <li><a href="enrollaccount.jsp" class="current">Enroll/Un-enroll Account</a></li>
                    <li><a href="makedefault.jsp">Edit Account</a></li>
                    <li><a href="regpayee.jsp">Register Payee</a></li>
                    <li><a href="transact.jsp">Pay Bill</a></li>

                </ul>
            </div> <!-- end of templatemo_menu -->

        </div> <!-- end of templatemo_menu_wrapper -->



        <div id="templatemo_content">
            <table cellpadding="3" cellspacing="3"  width="800px" border="1" align="center">

                <form ACTION="enrollaccountprocess.jsp" METHOD="POST">
                    <%

                                Connection con = null;

                                String driver = "oracle.jdbc.OracleDriver";
                                try {
                                    try {
                                        Class.forName(driver);
                                        //System.out.println("hi");
                                        con = DriverManager.getConnection("jdbc:oracle:thin:@" + dblocal + ":1521:" + db + "", dbuser, dbpass);

                                        Statement st3 = con.createStatement();
                                        ResultSet res11 = st3.executeQuery("select * from onbill_customer where billstatus=1 and custid=" + custid + "");
                                        if (res11.next()) {
                    %>
                    <th bgcolor="#880000" colspan="4">
                        <label>Enroll Your Account For Bill Payment</label>
                        <br/>
                        <font size=2 color="red"><sup>*</sup> Required Fields</font>
                    </th>

                    <tr>
                        <td valign="top" colspan="2" bgcolor="#888000">
                            <label>Select Your Account<sup>*</sup></label>
                        </td>


                        <td valign="top" colspan="2" bgcolor="#888000">
                            <SELECT NAME="select" style="width:220px">
                                <%



                                                                            try {
                                                                                try {
                                                                                    Class.forName(driver);
                                                                                    //System.out.println("hi");
                                                                                    con = DriverManager.getConnection("jdbc:oracle:thin:@" + dblocal + ":1521:" + db + "", dbuser, dbpass);

                                                                                    Statement st = con.createStatement();


                                                                                    ResultSet res = st.executeQuery("select * from onbill_account  where custid=" + "'" + custid + "'");
                                                                                    while (res.next()) {
                                %>

                                <OPTION><%=res.getString(2)%></OPTION>

                                <%

                                                                                    }

                                                                                } catch (SQLException s) {
                                                                                    System.out.println("error in sql");
                                                                                }
                                                                            } catch (Exception e) {
                                                                                e.printStackTrace();
                                                                            }


                                %>
                            </SELECT>
                        </td>

                    </tr>
                    <tr>
                        <td valign="top" colspan="2" bgcolor="#888000">
                            <label>Enroll/Unenroll Account For Bill Pay<sup>*</sup></label>
                        </td>
                        <td valign="top" colspan="2" bgcolor="#888000">
                            <SELECT NAME="enr"  style="width:220px">
                                <OPTION value="enroll">Enroll Account</OPTION>
                                <OPTION value="unenroll">Un-Enroll Account</OPTION>
                            </SELECT>
                        </td>
                    </tr>
                    <tr bgcolor="#888000" >
                        <td colspan="4">
                            <INPUT TYPE="image" SRC="images/submit.jpg" HEIGHT="30" WIDTH="100" BORDER="0" ALT="Submit Form">
                        </td>
                    </tr>
                </form>

                <% } else {%>
                <th>
                    <label>Please Register For Online Bill Payment To Avail This facility</label>
                </th>
                <% }

                                } catch (SQLException s) {
                                    System.out.println("error in sql");
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }


                %>

            </table>
        </div> <!-- end of templatemo_content -->



        <div id="templatemo_content_bottom"></div>

        <div id="templatemo_footer_wrapper">

        </div> <!-- end of footer wrapper -->
    </body>
</html>